import request from '@/utils/request'
import {encodeParams} from '@/utils'
import Cookies from 'js-cookie'
const userId = Cookies.get('useId-B')
//普通运营账号列表
export function getUserList(data) {
  return request({
    url: `/api/user/tenant?${encodeParams(data)}`,
    method: 'GET',
    data
  })
}

//获取账号信息
export function getUserInfo(data) {
  return request({
    url: '/api/user/findUser',
    method: 'POST',
    data
  })
}


//创建用户
export function create(data) {
  return request({
    url: `/api/user/tenant`,
    method: 'POST',
    data
  })
}

//通过UserId获取用户信息(B端用户管理)
export function getUser(id) {
  return request({
    url: `/api/user/B/${id}`,
    method: 'GET'
  })
}


//修改用户
export function update(id,data) {
  return request({
    url: `/api/user/tenant/${id}`,
    method: 'PUT',
    data
  })
}

//重置密码(B端重置密码)
export function resetPassword(userId) {
  return request({
    url: `/api/user/B/${userId}/resetPassword`,
    method: 'PUT',
  })
}


//删除角色
export function deleteIt(id) {
  return request({
    url: `/api/user/${id}`,
    method: 'DELETE'
  })
}

//更改用户状态
export function changeUserStatus(id, enabled) {
  return request({
    url: `/api/user/enable/${id}/${enabled}`,
    method: 'GET'
  })
}

